package com.dycong.common.web;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author dycong
 * @date 2018/4/19 14:56
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class JSONResult<T> implements Serializable {

    private static final long serialVersionUID = -3530193435381215952L;
    /**
     * -1 : 系统错误 0 ： OK -2 ：参数错误
     */
    Integer code;
    String msg;
    T data;

    public static JSONResult fromJson(String json) {
        return JSON.parseObject(json, JSONResult.class);
    }

}
